Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-redux-typescript

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-redux-typescript

React / Redux / TypeScript Utils

  • 2.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React / Redux / TypeScript Utils

Redux helpers for Type-safety (action types, action creators, reducers)

  • Semantic Versioning
  • No external dependencies
  • 100% test coverage
  • output es5 and es6 bundles

Table of Contents (v3.0)

Redux Utils

Mapped Types

  • Diff
  • Omit
  • Overwrite

Types Utils

Docs v2.X


Redux Utils




Mapped Types

Diff
// TestDiff expects: ('a' | 'b')
type TestDiff = Diff<'a' | 'b' | 'c', 'c' | 'd'>;
Omit
// TestOmit expects: { b: number, c: boolean }
type TestOmit = Omit<{ a: string, b: number, c: boolean }, 'a'>;
Overwrite
// TestOverwrite expects: { b: number, c: boolean } & { a: number }
type TestOverwrite = Overwrite<{ a: string, b: number, c: boolean }, { a: number }>;

Types Utils

getReturnOfExpression

Get return value of an "expression" with inferred return type
alias: returntypeof
https://github.com/Microsoft/TypeScript/issues/6606

// this polyfill exist because TypeScript does not support getting type of expression 
// (tracking issue: https://github.com/Microsoft/TypeScript/issues/6606)
export function getReturnOfExpression<RT>(
  expression: (...params: any[]) => RT,
): RT {
  return null as any as RT;
}

// Example:
import { getReturnOfExpression } from 'react-redux-typescript';

const increment = () => ({ type: 'INCREMENT' as 'INCREMENT' });

const returnOfIncrement = getReturnOfExpression(increment);
type INCREMENT = typeof returnOfIncrement; // { type: "INCREMENT"; }

MIT License

Copyright (c) 2016 Piotr Witek piotrek.witek@gmail.com (http://piotrwitek.github.io)

Keywords

FAQs

Package last updated on 15 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc